UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mbz4ypnnNfyrjDH28241ghUQXevKHRoe+ED77WcXnZI=' 
WHERE 
  key_id = '9e97396f3f50fc4100d0abce4d1177a92523f53090dbd573d3b8cfdaa12ed516' 
  AND (
    token = 'mbz4ypnnNfyrjDH28241ghUQXevKHRoe+ED77WcXnZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018