UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YQqRwK5ukACiysofYj0hsTb/N3snl80z3pptbekvUUY=' 
WHERE 
  key_id = 'c0d3e9f01b00f4e45903f5a085f2a93d1a7df84740e8e75c9a716f7f7794d61a' 
  AND (
    token = 'YQqRwK5ukACiysofYj0hsTb/N3snl80z3pptbekvUUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020