UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cKpG3RkybksRIKq+HWc2/CP3Xi0DCRcNbXfGK8/FPq4=' 
WHERE 
  key_id = '82ee4c0336c190d3ec5813b7602bd39a7350080b9cc7e022cb75029a381d840c' 
  AND (
    token = 'cKpG3RkybksRIKq+HWc2/CP3Xi0DCRcNbXfGK8/FPq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032