UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bsKC33u21lz21L6vsqForzHxCjVFlMMvIYgf6GTQsIk=' 
WHERE 
  key_id = 'c93e88ca378f816792207d7d510a4a6733e53d4b1c537c7822d077892499f78b' 
  AND (
    token = 'bsKC33u21lz21L6vsqForzHxCjVFlMMvIYgf6GTQsIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029