UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H6WVh3vD2nVHD0wIALzJWFHg9kVylhtc2lioi4FgYrc=' 
WHERE 
  key_id = '0563ed8597b11b959db6d2f02d70cf16b40f08d909153435230208201cebf154' 
  AND (
    token = 'H6WVh3vD2nVHD0wIALzJWFHg9kVylhtc2lioi4FgYrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041