UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kYA60RM8TLDkallr/HUObmRM2LEUS1hJN6IVw2yjQa0=' 
WHERE 
  key_id = '71d6e10edb059406001e415bde26b9c38c1427397f3724c83dcc2d93861bc44e' 
  AND (
    token = 'kYA60RM8TLDkallr/HUObmRM2LEUS1hJN6IVw2yjQa0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048