UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AzgVOZiRaukfKBORqUkZ1hH516w0xvUJcvJIHP0VMB8=' 
WHERE 
  key_id = '9e5d34fe5efbc1c6ada35ca312d1589311af4ad0ad3187a35d8b0446ff8fe851' 
  AND (
    token = 'AzgVOZiRaukfKBORqUkZ1hH516w0xvUJcvJIHP0VMB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049