UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qiw8CP+BNARqYtWJ47EWN+ZsrAErAE1kt8YRUeg/4vQ=' 
WHERE 
  key_id = '9fda9e3c76e65030b0f477bf1c98d6f6a9fd3db11462139a39d1341eb9e407b4' 
  AND (
    token = 'Qiw8CP+BNARqYtWJ47EWN+ZsrAErAE1kt8YRUeg/4vQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031