UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WashkQaTzmoIgow737SzUgOWI0YtGuQBYOZjUeMBucI=' 
WHERE 
  key_id = '791f5386b60d34030b638a01bbb6fcdf4b7bfe8588d49ad0ba25bbff12b8b898' 
  AND (
    token = 'WashkQaTzmoIgow737SzUgOWI0YtGuQBYOZjUeMBucI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052