UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fwUS8pICxH+GGFngSlZ/eB8rD2zAOmLN87X3hFD79VY=' 
WHERE 
  key_id = '33827beb842cc531f2dd16d288a7ce94c038149dc2e3e962e7794d61de08cd42' 
  AND (
    token = 'fwUS8pICxH+GGFngSlZ/eB8rD2zAOmLN87X3hFD79VY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037