UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DaC7MTUe788VBVQ/bNsLkx0mPI/fBkvWnRhIbsVNAQw=' 
WHERE 
  key_id = 'aa2270fead44ce45eb137c64726dd53ea382eedc5be4c529a176c370a498afab' 
  AND (
    token = 'DaC7MTUe788VBVQ/bNsLkx0mPI/fBkvWnRhIbsVNAQw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00263