UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J4Gvn6n5313E2n3UtQmf5UIwaG9FUYGgMSZU3KwqId8=' 
WHERE 
  key_id = '620bddcdca9ba03dee41cec23e30828d0c71eb55badcf86e069302471dc00bb9' 
  AND (
    token = 'J4Gvn6n5313E2n3UtQmf5UIwaG9FUYGgMSZU3KwqId8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025