UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yK9z8UY46ocO04omolNsKZ4GSPIhcOBBGwOOoNLbSH8=' 
WHERE 
  key_id = 'bc802dd748ee87b2b9e8d689c0f07abf8eeda7449e0c77d3f21ca5bb48b7000f' 
  AND (
    token = 'yK9z8UY46ocO04omolNsKZ4GSPIhcOBBGwOOoNLbSH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044