UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KsYFfjclJs+L4NINhgksDn3zQiifpJSTx6Q6STb8vqY=' 
WHERE 
  key_id = '8349dd4def6dd8d1f9a2eda3e20350a1f91a4376bfec07126fc2f52b0031071d' 
  AND (
    token = 'KsYFfjclJs+L4NINhgksDn3zQiifpJSTx6Q6STb8vqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00111