UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mf8JNs8CSHVDbTGJm5k9P+ftD6+jnr4onmLX7YMlKHs=' 
WHERE 
  key_id = '18a80e1b6accefc2f5991b0b2e96a28a12ce3932a0d7ebcb05a08c2cd498a198' 
  AND (
    token = 'mf8JNs8CSHVDbTGJm5k9P+ftD6+jnr4onmLX7YMlKHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046