UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c2Z5931x0ZL8Z77QNBCz0WzpaiOm//9yqFd6AgMtl6A=' 
WHERE 
  key_id = 'c7697d40dcc8685bf35b7d19738f2cedf5bcf84ae3284b26a66a651f5aa95f38' 
  AND (
    token = 'c2Z5931x0ZL8Z77QNBCz0WzpaiOm//9yqFd6AgMtl6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060