UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kh6pW1byP5T1soKMQJtKbCWdhKNVIRf0bzijQOfbgq8=' 
WHERE 
  key_id = '494d9cde5727d02d23e291726d3447a6091bd8f5dce0f1a0e75def4c8b7f7baa' 
  AND (
    token = 'Kh6pW1byP5T1soKMQJtKbCWdhKNVIRf0bzijQOfbgq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032