UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kxNG6U/zIhxGwF0Gh+fX8uU2UgcU4z05vAUT3EDWmQo=' 
WHERE 
  key_id = '8882f66135a48c3295e9b280967bc2e39ce12598c5447d1c9d72d0751f086d70' 
  AND (
    token = 'kxNG6U/zIhxGwF0Gh+fX8uU2UgcU4z05vAUT3EDWmQo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041