UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NTeqjFDEvJsqCWQykphN6gSY6uSdEgGHObZpwmJoRNE=' 
WHERE 
  key_id = 'b9944309fc36ad90066b362aeafdbbcb8309dd819776a78c32d0512894502407' 
  AND (
    token = 'NTeqjFDEvJsqCWQykphN6gSY6uSdEgGHObZpwmJoRNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045