UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LJ+s7g7sX9QpjJrA1NHik6aS9HpkD+/5N2wpVs+mLF4=' 
WHERE 
  key_id = '7f3d6cf270400c6802ad977f2720e492a41adbdd59601d65af60b37196881c2d' 
  AND (
    token = 'LJ+s7g7sX9QpjJrA1NHik6aS9HpkD+/5N2wpVs+mLF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037