UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hu5DZWSzw+J5jDJ45BPcrsURrHLSxHJRtDZpCVVdRfg=' 
WHERE 
  key_id = '8b737dd1937b4e25970139a70b8b019a9d4332a3aa0c4258248e1a273b92f24a' 
  AND (
    token = 'hu5DZWSzw+J5jDJ45BPcrsURrHLSxHJRtDZpCVVdRfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045