UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ayc8l+bMZL84j5Wq5zV/Qxqvc/TjUlRGi927Dfej/Io=' 
WHERE 
  key_id = '4d694c1a100af053dc8b607fb153a6366878eb3cade0d375c0992f0fc3536d1d' 
  AND (
    token = 'Ayc8l+bMZL84j5Wq5zV/Qxqvc/TjUlRGi927Dfej/Io=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037