UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+DFmxqCkqMPfdpHeiiHGK5Ysvw4vTMerqMxTca2Z+Q=' 
WHERE 
  key_id = 'c0eb45c0256fa90e65a7b7a5bcdb59f12f5176d2bd1e0722755152ac881bc938' 
  AND (
    token = 'C+DFmxqCkqMPfdpHeiiHGK5Ysvw4vTMerqMxTca2Z+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034