UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3EafQVYocvMFpEONyiOf545W4A+VnrwsBYAWA5/8HsM=' 
WHERE 
  key_id = '76c78ed0f52979b6a2a99e27e8fd4ef404f0fa539df972474e9c43ebb13abf28' 
  AND (
    token = '3EafQVYocvMFpEONyiOf545W4A+VnrwsBYAWA5/8HsM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038