UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'moS9J7Mh2m6YEcL2d61GURvVDaUZH7GGso/ZYX9c/Y4=' 
WHERE 
  key_id = '34ee18d829b99dfb0e1689674c06cef0da7bda94d5baa2ffff37055b90400432' 
  AND (
    token = 'moS9J7Mh2m6YEcL2d61GURvVDaUZH7GGso/ZYX9c/Y4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040