UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UoD820FvuktvcCz6tAkwpSoa69L+i6WkeKSLRfq+Vd8=' 
WHERE 
  key_id = '18e6a706dbd23d5a36e0c1c3d90c13b71fe4294244c585fc68d86a1b9cf84459' 
  AND (
    token = 'UoD820FvuktvcCz6tAkwpSoa69L+i6WkeKSLRfq+Vd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035