UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'InSWAA0UTNJieuq94ujCBd01Uq8y2+AMLby363IMbrw=' 
WHERE 
  key_id = 'a8efa6c4e1ddcbd1aafc7a971471a8b2eef25663559a7804fa59718bf2e794f4' 
  AND (
    token = 'InSWAA0UTNJieuq94ujCBd01Uq8y2+AMLby363IMbrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035