UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8FAI3sOoHt2LlYGsg6VKQCS9ASIHhHBVVg9xN1MbLS0=' 
WHERE 
  key_id = '46cb3bdfa0de32030f09a490580927b0cd1c9b9e47781e07f78fec4778210386' 
  AND (
    token = '8FAI3sOoHt2LlYGsg6VKQCS9ASIHhHBVVg9xN1MbLS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036