UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qN7nHPO7lBASpPe5bKUEJH+iKOHHFwzLBGdoDdeI+jY=' 
WHERE 
  key_id = '28b123a06a97197838c94d3c4bf692f42d0a81dcf16c5806dc33e52ef8562fde' 
  AND (
    token = 'qN7nHPO7lBASpPe5bKUEJH+iKOHHFwzLBGdoDdeI+jY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029