UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hgP37d4MFfiFPHt4jBq+veCntlm0r1792sm4MVtn4Yc=' 
WHERE 
  key_id = 'd9d5b3de2464c37fd838a5cb82ce83b37450de429e924fc0292e6a673bb83337' 
  AND (
    token = 'hgP37d4MFfiFPHt4jBq+veCntlm0r1792sm4MVtn4Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017