UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IuPWmqBz+0YlMrlhzJs+v8tg2JBvuQ+6wzQp7NcgeDE=' 
WHERE 
  key_id = '8eed722dddfcd167ffac154ff2d0375f9d53f7cd53f43f19eadd2ca3c7f50405' 
  AND (
    token = 'IuPWmqBz+0YlMrlhzJs+v8tg2JBvuQ+6wzQp7NcgeDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054