UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8cUOWcaxnKhLFBNyaLy3R0weZDc9pj39UDLjiopK8pM=' 
WHERE 
  key_id = '9b27cd0a629dbd4976f2402d235d46e2538f927d3a7059bfc3168c26ff424093' 
  AND (
    token = '8cUOWcaxnKhLFBNyaLy3R0weZDc9pj39UDLjiopK8pM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00209