UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KpfLKRhkAUF30knEBzbk8qROEk+QTBmXMY6NcE6YYfU=' 
WHERE 
  key_id = '253f2e0c8c2b693095513d923c6613f658a2755c3b2c482f3c4842661face9e8' 
  AND (
    token = 'KpfLKRhkAUF30knEBzbk8qROEk+QTBmXMY6NcE6YYfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034