UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8RGIvC4nC7r8BxBhlf83S7SOHALzaF1rBW3bjo905Q=' 
WHERE 
  key_id = 'b835702adb1c75c6570e373cd9796d3eaf35556731d3ecb8e66c074289befc8c' 
  AND (
    token = 'w8RGIvC4nC7r8BxBhlf83S7SOHALzaF1rBW3bjo905Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024