UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E7A94BP+SP6JJCI3ux2vVbBs37Y3WOPjnrRfcA1whuM=' 
WHERE 
  key_id = '18335acffcbfe55c6d9522df499d5d41b225175b9cfe196e21dca43c3a4614cc' 
  AND (
    token = 'E7A94BP+SP6JJCI3ux2vVbBs37Y3WOPjnrRfcA1whuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032