UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T7+UItiTDgVFHYaLekZVWzwPxzSC8fpTg+pJqo+LKVU=' 
WHERE 
  key_id = '949f391b635bd095c0c20db790ad4c7e421bbac566790d8ada9fe01a6d9f914b' 
  AND (
    token = 'T7+UItiTDgVFHYaLekZVWzwPxzSC8fpTg+pJqo+LKVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030