UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0bzJrf7WK5Dx+m9UO3x4sMywSEiB+21pKEBpAU9Gi2A=' 
WHERE 
  key_id = '7dfd2d6db3db8cb057d6a8a826cdb4d1aaa3e393d1bfdabf73d42c4366a41925' 
  AND (
    token = '0bzJrf7WK5Dx+m9UO3x4sMywSEiB+21pKEBpAU9Gi2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021