UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BC3c/c3LwNO37pwqv4Z3EPnLxQXUqWWxmtErsY8N4NI=' 
WHERE 
  key_id = 'e30aa7bca7c35373b42554172ae6360eddcb73368ea38c3099db1dbdd88a9054' 
  AND (
    token = 'BC3c/c3LwNO37pwqv4Z3EPnLxQXUqWWxmtErsY8N4NI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021