UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tT+dRl8h2DeXCtCRoQlKs0JIK0rX5+YKJQyaaTkO43k=' 
WHERE 
  key_id = 'c792cd4e0d90577d246892d7004b75c4b649a64cb287ffb8c09e965a43e2794c' 
  AND (
    token = 'tT+dRl8h2DeXCtCRoQlKs0JIK0rX5+YKJQyaaTkO43k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044