UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iGUcArvP9y7EbuL6+0xlphJFTPezuiHpiymaDuIjgT0=' 
WHERE 
  key_id = '7167a2dd6fed926e89d7817e2a08b29c8e660d320fc2e0fc61417f44a92a2f46' 
  AND (
    token = 'iGUcArvP9y7EbuL6+0xlphJFTPezuiHpiymaDuIjgT0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037