UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '86436bmTOBKTR9wGQRQ0b+kYH3iTuCFkQ6ZPGV0SoBc=' 
WHERE 
  key_id = '059849b48bbe3ed12401029ec4ed5957ba996a06caa076e0d3c68d103617b4ad' 
  AND (
    token = '86436bmTOBKTR9wGQRQ0b+kYH3iTuCFkQ6ZPGV0SoBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032