UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n+TcC0/P0hXoGc+Z8gACZkFksrPvC1oVhJH1RMFOLiw=' 
WHERE 
  key_id = 'e85456c1b188ad6b4292a4c0b0d427d1bf5287b41eda815d380cc575ef1450ef' 
  AND (
    token = 'n+TcC0/P0hXoGc+Z8gACZkFksrPvC1oVhJH1RMFOLiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044