UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9M3xDUX5dUyrJYESYblU5UoD91IUwHdKmkE/LkFPZN0=' 
WHERE 
  key_id = '3f2bac5f7a7223baad6cb3da01b2da0b7e14ca80f34b2281648013fb503aa443' 
  AND (
    token = '9M3xDUX5dUyrJYESYblU5UoD91IUwHdKmkE/LkFPZN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026