UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fSoYf35ZoMrAhwS0UsUR5zQ/jycbWFV1wUjuKFnNozk=' 
WHERE 
  key_id = '1ffcd6e544b8a6a8243034e480b09cb66d346f1eb6b903dc25032f3be12a681d' 
  AND (
    token = 'fSoYf35ZoMrAhwS0UsUR5zQ/jycbWFV1wUjuKFnNozk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050