UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r6iqyrO8OeU4uKDbD+keE9jwHIL28m9tOvx/IAkxoKs=' 
WHERE 
  key_id = 'f92e29fba42078e580b51ee6e7cb4382adfb5a5f8e854f76e291cac4b90e9371' 
  AND (
    token = 'r6iqyrO8OeU4uKDbD+keE9jwHIL28m9tOvx/IAkxoKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024