UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2bd0Ff7BD+uaxTyJ2zWunzCHsEUPehBPIN63DSYVgWk=' 
WHERE 
  key_id = '1a7240f365da5bff91cede861ffe4eb447bc380539351d3c717a85b0624c2dfa' 
  AND (
    token = '2bd0Ff7BD+uaxTyJ2zWunzCHsEUPehBPIN63DSYVgWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038