UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k8oNbmbcSNIewhR+cVSD8u4p29CXVbBcdnOAhcN4Q50=' 
WHERE 
  key_id = '9582ae2916df8c93e95d5bf21ab7a7ac664459fe0bea0a36595555238dc6df64' 
  AND (
    token = 'k8oNbmbcSNIewhR+cVSD8u4p29CXVbBcdnOAhcN4Q50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023